<div class="box">
 
  
    <div class="box-category">
      <ul>
        <?php for($i=0;$i<count($categories);$i++){?>
        <?php if($i%2==0){?>
        <li class="blue">
        <?php }else{?>
        <li class="red">	
        <?php }?>
          <?php if ($categories[$i]['category_id'] == $category_id) { ?>
          <a href="<?php echo $categories[$i]['href']; ?>" class="active"><?php echo $categories[$i]['name']; ?></a>
          <?php } else { ?>
          <a href="<?php echo $categories[$i]['href']; ?>"><?php echo $categories[$i]['name']; ?></a>
          <?php } ?>
          <?php if ($categories[$i]['children']) { ?>
          <ul>
            <?php foreach ($categories[$i]['children'] as $child) { ?>
            <li>
              <?php if ($child['category_id'] == $child_id) { ?>
              <a href="<?php echo $child['href']; ?>" class="active"><?php echo $child['name']; ?></a>
              <?php } else { ?>
              <a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a>
              <?php } ?>
            </li>
            <?php } ?>
          </ul>
          <?php } ?>
        </li>
        <?php } ?>
      </ul>
    </div>
  
</div>
